<?php
/**
 * PureMVC Port to PHP originally translated by Asbjørn Sloth Tønnesen
 *
 * @author Omar Gonzalez :: omar@almerblank.com
 * @author Hasan Otuome :: hasan@almerblank.com
 *
 * Created on Sep 24, 2008
 * PureMVC - Copyright(c) 2006-2008 Futurescale, Inc., Some rights reserved.
 * Your reuse is governed by the Creative Commons Attribution 3.0 Unported License
 */

/**
 * A base <code>PureMVC_Observer_Notification_Interface</code> implementation.
 *
 * @see org.puremvc.php.patterns.observer.Observer Observer
 *
 */

class PureMVC_Observer_Notification implements PureMVC_Observer_Notification_Interface
{
	// the name of the notification instance
	private $_name;
	// the type of the notification instance
	private $_type;
	// the body of the notification instance
	private $_body;

	/**
	 * Constructor.
	 *
	 * @param name name of the <code>Notification</code> instance. (required)
	 * @param body the <code>Notification</code> body. (optional)
	 * @param type the type of the <code>Notification</code> (optional)
	 */
	public function __construct( $name, $body = null, $type = null )
	{
		$this->_name = $name;
		$this->_body = $body;
		$this->_type = $type;
	}

	/**
	 * Get the name of the <code>Notification</code> instance.
	 *
	 * @return the name of the <code>Notification</code> instance.
	 */
	public function getName()
	{
		return $this->_name;
	}

	/**
	 * Set the body of the <code>Notification</code> instance.
	 */
	public function setBody( $body )
	{
		$this->_body = $body;
	}

	/**
	 * Get the body of the <code>Notification</code> instance.
	 *
	 * @return the body object.
	 */
	public function getBody()
	{
		return $this->_body;
	}

	/**
	 * Set the type of the <code>Notification</code> instance.
	 */
	public function setType( $type )
	{
		$this->_type = $type;
	}

	/**
	 * Get the type of the <code>Notification</code> instance.
	 *
	 * @return the type
	 */
	public function getType()
	{
		return $this->_type;
	}

	/**
	 * Get the string representation of the <code>Notification</code> instance.
	 *
	 * @return the string representation of the <code>Notification</code> instance.
	 */
	public function toString()
	{
		$msg = "Notification Name: " . $this->getName();
		$msg .= "\nBody:";
		$msg .= ( $this->_body == null ) ? "null" : $this->_body;
		$msg .= "\nType:";
		$msg .= ( $this->_type == null ) ? "null" : $this->_type;
		return $msg;
	}
}
